package com.ctyun.xstore.s3.api.bucket;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.Bucket;
import com.ctyun.xstore.s3.client.AmazonS3ClientBuilder;

import java.util.List;

public class ListBuckets {
    public static void listBuckets() {
        AmazonS3 s3 = AmazonS3ClientBuilder.buildAmazonS3Client();
        List<Bucket> buckets = s3.listBuckets();
        System.out.println("Amazon S3 buckets are:");
        for (Bucket b : buckets) {
            System.out.println("* " + b.getName());
        }
    }
}